package com.animations;

import com.beans.PipeBean;
import java.awt.Image;
import java.awt.Rectangle;
import java.util.ArrayList;

class Pipes {

  private Image up_Pipe;
  private Image down_Pipe;
  private Rectangle pipeUR;
  private Rectangle pipeDR;
  private int pipeX;
  private int pipeuY;
  private int pipedY;
  private int pipeW;
  private int pipeH;

  public Pipes(PipeBean pipe) {
    this.up_Pipe = ((Image) pipe.getPipes().get(0));
    this.down_Pipe = ((Image) pipe.getPipes().get(1));
    this.pipeW = pipe.getPipeW();
    this.pipeH = pipe.getPipeH();
    this.pipeX = 345;
    this.pipeuY =
      (int) (this.pipeH + 80 - (this.pipeH - 110 - 30) * Math.random());
    this.pipedY = (this.pipeuY - 110 - pipe.getPipeH());
    this.pipeUR =
      new Rectangle(this.pipeX, this.pipeuY, this.pipeW, this.pipeH);
    this.pipeDR =
      new Rectangle(this.pipeX, this.pipedY, this.pipeW, this.pipeH);
  }

  public Image getUp_Pipe() {
    return this.up_Pipe;
  }

  public Image getDown_Pipe() {
    return this.down_Pipe;
  }

  public int getPipeX() {
    return this.pipeX;
  }

  public void setPipeX(int pipeX) {
    this.pipeUR.setBounds(pipeX, this.pipeuY, this.pipeW, this.pipeH);
    this.pipeDR.setBounds(pipeX, this.pipedY, this.pipeW, this.pipeH);
    this.pipeX = pipeX;
  }

  public int getUpPipeY() {
    return this.pipeuY;
  }

  public int getDownPipeY() {
    return this.pipedY;
  }

  public Rectangle getPipeUR() {
    return this.pipeUR;
  }

  public Rectangle getPipeDR() {
    return this.pipeDR;
  }
}
